import {
	Button,
	Collapse,
	Form,
	Row,
	Col,
	Input,
	Select,
	message,
	Cascader,
	DatePicker,
	TreeSelect,
	Tabs,
} from 'antd'
import React, {useState, useEffect, memo} from 'react'
import {history, connect} from 'umi'
import moment from 'moment'
import styles from './index.less'
import {editAccident, viewAccident} from '@/service/carMessage/accident'
import {insuranceType, compliance, claimStatus} from '../../dict'
import {getCompany} from '@/service/system/company'
import {translateDataToTree} from '@/utils/common/index'
import {getAllCitys} from '@/service/common'
import UploadAvatar from '@/components/UploadAvatar'
import {getDict} from '@/service/common/dict'
import 'moment/locale/zh-cn'
import { twoDecimalPattern } from '@/utils/common/validator'
import { getImageUrlList } from '@/utils/image'

const {TextArea} = Input
const {Panel} = Collapse
const customizeHeader = (value: string) => (
	<div>
		<div className={styles.tip} />
		{value}
	</div>
)

const licenceEdit = memo((props: any) => {
	const [dict, setDict] = useState({
		Claim_Insurance_Type: [],
		Accident_Status: [],
		Accident_Level: [],
		Accident_Type: [],
		Duty_Type: [],
	})
	const [type, setType] = useState<string>()
	const [form] = Form.useForm<any>()

	const [accidentId, setAccidentId] = useState()
	const [orgSource, setOrgSource] = useState<any>([])
	const [citysList, setCitysList] = useState([])

	const [filingForm] = Form.useForm<any>()
	const [compensationForm] = Form.useForm<any>()
	const [closingForm] = Form.useForm<any>()
	const [accidentForm] = Form.useForm<any>()
	const [fileList, setFileList] = useState<any>([])

	/** 获取城市列表 */
	const getCitysFun = () => {
		getAllCitys().then((res: any) => {
			if (res?.data) {
				setCitysList(() => res.data)
			}
		})
	}

	useEffect(() => {
		getCitysFun()
	}, [props?.user?.orgId])

	// 获取组织机构数据
	const onOrgFun = () => {
		getCompany({merchantId: props?.user?.orgId}).then((res: any) => {
			if (res?.success) {
				const list: any = translateDataToTree(res?.data)
				setOrgSource(list as any)
			}
		})
	}

	useEffect(() => {
		onOrgFun()
	}, [props?.user?.orgId])

	// 初始化-附件列表
	const getFileList = (ids: Array<string>) => {
		const imageList = ids.map(id => ({
				id,
				name: '事故照片',
				targetAttr: 0,
			}));
		const list = getImageUrlList(imageList);
		setFileList(list);
	}
	// 初始化-详情数据
	const getView = (id: string) => {
		viewAccident({id}).then((res: any) => {
			if (res?.success) {
				form.setFieldsValue({...res.data})
				filingForm.setFieldsValue({
					...res?.data,
					insuranceOrderTime: res?.data?.insuranceOrderTime
						? moment(res?.data?.insuranceOrderTime)
						: '',
					reporterTime: res?.data?.reporterTime
						? moment(res?.data?.reporterTime)
						: '',
					occurrenceTime: res?.data?.occurrenceTime
						? moment(res?.data?.occurrenceTime)
						: '',
				})
				compensationForm.setFieldsValue({
					...res?.data?.settleExtra,
					commercialPayTime: res?.data?.settleExtra?.commercialPayTime
						? moment(res?.data?.settleExtra?.commercialPayTime)
						: '',
				})
				closingForm.setFieldsValue({
					...res?.data?.settleExtra,
					closureTime: res?.data?.settleExtra?.closureTime
						? moment(res?.data?.settleExtra?.closureTime)
						: '',
				})
				accidentForm.setFieldsValue({...res.data})
				if (res?.data?.photoList?.length) {
					getFileList(res?.data?.photoList)
				}
			}
		})
	}

	// 根据路由判断当前页面状态
	useEffect(() => {
		const {id} = props.location.query
		getDict(
			{
				dictKeys: [
					'Claim_Insurance_Type',
					'Accident_Status',
					'Accident_Level',
					'Accident_Type',
					'Duty_Type',
				],
			},
			(res: any) => {
				setDict(res)
			},
		)
		if (id) {
			getView(id)
			setAccidentId(id)
		}
		const hrefs = window.location.href
		if (hrefs.includes('view')) {
			setType('view')
		} else {
			setType('edit')
		}
	}, [])

	// 事故照片
	const uploadProps = {
		text: '添加文件',
		modelName: 'ACCIDENT_FJ',
		accept: 'image/jpeg,image/png',
		targetAttr: 0,
		list: fileList,
		moreNum: 500,
		callback: (res: any) => {
			const fileLists = res?.fileList?.map(
				(item: any) => item?.response?.data?.id,
			)
			accidentForm.setFieldsValue({
				photoList: [...fileLists],
			})
		},
	}
	// 保存
	const onSubmit = async () => {
		const formData = await form.validateFields()
		const compensationFormData = await compensationForm.validateFields()
		const accidentFormData = await accidentForm.validateFields()
		editAccident({
			id: accidentId,
			accidentStatus: formData.accidentStatus,
			settleExtra: {
				...compensationFormData,
				commercialPayTime: moment(
					compensationFormData?.commercialPayTime,
				).format('YYYY-MM-DD HH:mm:ss'),
			},
			photoList: accidentFormData?.photoList,
		})
			.then((res) => {
				if (res.success) {
					message.success(res.msg)
					history.goBack()
				}
			})
			.catch((err) => {
				message.error(err)
			})
	}

	return (
		<div className={styles.admittanceAdd}>
			<div className={`${styles.content} ${styles.formDetils}`}>
				<Collapse
					defaultActiveKey={['1', '2']}
					ghost
					expandIconPosition="end">
					<Panel header={customizeHeader('基础信息')} key="1">
						<Form
							form={form}
							name="basic"
							layout="horizontal"
							labelCol={{flex: '180px'}}
							labelAlign="right"
							labelWrap
							initialValues={{remember: true}}
							autoComplete="off"
							disabled={type === 'view'}>
							<Row gutter={12}>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item label="所属公司" name="orgId">
										<TreeSelect
											disabled
											showSearch
											style={{width: '100%'}}
											dropdownStyle={{
												maxHeight: 400,
												overflow: 'auto',
											}}
											placeholder="请选择"
											allowClear
											treeDefaultExpandAll
											fieldNames={{
												label: 'name',
												value: 'id',
											}}
											treeDataSimpleMode
											treeData={[...orgSource]}
										/>
									</Form.Item>
								</Col>

								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item label="城市" name="cityId">
										<Cascader
											disabled
											fieldNames={{
												label: 'name',
												value: 'id',
												children: 'cityInfoList',
											}}
											options={citysList}
											placeholder="请选择"
										/>
									</Form.Item>
								</Col>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item label="持有方" name="holderName">
										<Input placeholder="请输入" disabled />
									</Form.Item>
								</Col>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item
										label="案件状态"
										name="accidentStatus">
										<Select
											placeholder="请选择"
											fieldNames={{
												value: 'dictKey',
												label: 'dictValue',
											}}
											options={[...dict.Accident_Status]}
										/>
									</Form.Item>
								</Col>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item label="车牌号" name="carPlateNo">
										<Input placeholder="请输入" disabled />
									</Form.Item>
								</Col>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item label="车架号" name="vin">
										<Input placeholder="请输入" disabled />
									</Form.Item>
								</Col>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item
										label="品牌车系车型"
										name="carBrandSeries">
										<Input placeholder="请输入" disabled />
									</Form.Item>
								</Col>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item
										label="发动机号"
										name="engineNumber">
										<Input placeholder="请输入" disabled />
									</Form.Item>
								</Col>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item label="司机ID" name="driverId">
										<Input placeholder="请输入" disabled />
									</Form.Item>
								</Col>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item
										label="司机姓名"
										name="driverName">
										<Input placeholder="请输入" disabled />
									</Form.Item>
								</Col>
								<Col
									sm={{span: 24}}
									md={{span: 12}}
									lg={{span: 8}}>
									<Form.Item
										label="司机身份证号"
										name="driverCardNo">
										<Input placeholder="请输入" disabled />
									</Form.Item>
								</Col>
							</Row>
						</Form>
					</Panel>
					<Panel header={customizeHeader('其他信息')} key="2">
						<div className={styles.tabs}>
							<Tabs
								type="card"
								defaultActiveKey="1"
								items={[
									{
										label: '立案信息',
										key: '1',
										children: (
											<>
												<Form
													form={filingForm}
													name="basic"
													layout="horizontal"
													labelCol={{flex: '180px'}}
													labelAlign="right"
													labelWrap
													initialValues={{
														remember: true,
													}}
													autoComplete="off"
													disabled={type === 'view'}>
													<Row gutter={12}>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="车险类别"
																name="insuranceType">
																<Select
																	disabled
																	placeholder="请选择"
																	fieldNames={{
																		value: 'key',
																		label: 'label',
																	}}
																	options={[
																		...insuranceType,
																	]}
																/>
															</Form.Item>
														</Col>

														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="保单号"
																name="insuranceNo">
																<Input
																	placeholder="请输入"
																	disabled
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="保险公司"
																name="insuranceCompanyName">
																<Input
																	placeholder="请输入"
																	disabled
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="城市"
																name="cityName">
																<Input
																	placeholder="请输入"
																	disabled
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="保险签单日期"
																name="insuranceOrderTime">
																<DatePicker
																	disabled
																	placeholder="请选择"
																	showTime
																	format="YYYY-MM-DD HH:mm:ss"
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="报案号"
																name="reportNo">
																<Input
																	placeholder="请输入"
																	disabled
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="立案号/赔案号"
																name="compensationNo">
																<Input
																	placeholder="请输入"
																	disabled
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="报案人"
																name="reporter">
																<Input
																	placeholder="请输入"
																	disabled
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="被保险人"
																name="insured">
																<Input
																	placeholder="请输入"
																	disabled
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="报案日期"
																name="reporterTime">
																<DatePicker
																	disabled
																	placeholder="请选择"
																	showTime
																	format="YYYY-MM-DD HH:mm:ss"
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="出险时间"
																name="occurrenceTime">
																<DatePicker
																	disabled
																	placeholder="请选择"
																	showTime
																	format="YYYY-MM-DD HH:mm:ss"
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="出险地点"
																name="occurrencePlace">
																<TextArea
																	disabled
																	maxLength={
																		200
																	}
																	placeholder="请输入（最多200个字）"
																	autoSize={{
																		minRows: 2,
																		maxRows: 3,
																	}}
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="事故经过"
																name="accidentProcess">
																<TextArea
																	disabled
																	maxLength={
																		200
																	}
																	placeholder="请输入（最多200个字）"
																	autoSize={{
																		minRows: 2,
																		maxRows: 3,
																	}}
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="事故类型"
																name="accidentType">
																<Select
																	disabled
																	placeholder="请选择"
																	fieldNames={{
																		value: 'dictKey',
																		label: 'dictValue',
																	}}
																	options={[
																		...dict.Accident_Type,
																	]}
																/>
															</Form.Item>
														</Col>
														<Col
															sm={{span: 24}}
															md={{span: 12}}
															lg={{span: 8}}>
															<Form.Item
																label="责任划分"
																name="dutyType">
																<Select
																	disabled
																	placeholder="请选择"
																	fieldNames={{
																		value: 'dictKey',
																		label: 'dictValue',
																	}}
																	options={[
																		...dict.Duty_Type,
																	]}
																/>
															</Form.Item>
														</Col>
													</Row>
												</Form>
											</>
										),
									},
									{
										label: '赔付信息',
										key: '2',
										children: (
											<Form
												form={compensationForm}
												name="basic"
												layout="horizontal"
												labelCol={{flex: '180px'}}
												labelAlign="right"
												labelWrap
												initialValues={{remember: true}}
												autoComplete="off"
												disabled={type === 'view'}>
												<Row gutter={12}>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="事故等级"
															name="accidentLevelType">
															<Select
																placeholder="请选择"
																fieldNames={{
																	value: 'dictKey',
																	label: 'dictValue',
																}}
																options={[
																	...dict.Accident_Level,
																]}
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="人伤估损"
															name="humanInjury">
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="未决金额"
															name="pendingAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input
																placeholder="请输入"

															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="标的车损"
															name="ratingAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入数字类型',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="标的车是否定损"
															name="ratingType">
															<Select
																placeholder="请选择"
																fieldNames={{
																	value: 'key',
																	label: 'label',
																}}
																options={[
																	...compliance,
																]}
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="标的车定损金额"
															name="ratingGiveAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="三者车损"
															name="thirdAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入数字类型',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="三者车定损金额"
															name="thirdGiveAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="交强险赔付金额"
															name="compulsoryPayAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="三者车是否定损"
															name="thirdType">
															<Select
																placeholder="请选择"
																fieldNames={{
																	value: 'key',
																	label: 'label',
																}}
																options={[
																	...compliance,
																]}
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="商业险赔付金额"
															name="commercialPayAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="商业险赔付时间"
															name="commercialPayTime">
															<DatePicker
																placeholder="请选择"
																showTime
																format="YYYY-MM-DD HH:mm:ss"
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="到款账户金额"
															name="payArriveAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="到款账户姓名"
															name="payArriveName">
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="到款账户号"
															name="payArriveAccount">
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="三者车损已决金额"
															name="thirdHaveGiveAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="三者人伤已决金额"
															name="thirdHumanGiveAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="标的车损已决金额"
															name="thirdCarGiveAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="三者车维修厂"
															name="thirdRepairFactory">
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="物损已决金额"
															name="materialGiveAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="标的车维修厂"
															name="ratingRepairFactory">
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="本车施救费已决金额"
															name="rescueCosts"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input placeholder="请输入" />
														</Form.Item>
													</Col>
												</Row>
											</Form>
										),
									},
									{
										label: '结案信息',
										key: '3',
										children: (
											<Form
												form={closingForm}
												name="basic"
												layout="horizontal"
												labelCol={{flex: '180px'}}
												labelAlign="right"
												labelWrap
												initialValues={{remember: true}}
												autoComplete="off"
												disabled={type === 'view'}>
												<Row gutter={12}>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="是否物损"
															name="materialDamageType">
															<Select
																disabled
																placeholder="请选择"
																fieldNames={{
																	value: 'key',
																	label: 'label',
																}}
																options={[
																	...compliance,
																]}
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="是否人伤"
															name="humanDamageType">
															<Select
																disabled
																placeholder="请选择"
																fieldNames={{
																	value: 'key',
																	label: 'label',
																}}
																options={[
																	...compliance,
																]}
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="人伤已决金额"
															name="humanDamageFee"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input
																placeholder="请输入"
																disabled
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="已决金额"
															name="decidedFee"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input
																placeholder="请输入"
																disabled
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="核赔状态"
															name="claimStatus">
															<Select
																disabled
																placeholder="请选择"
																fieldNames={{
																	value: 'key',
																	label: 'label',
																}}
																options={[
																	...claimStatus,
																]}
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="结案日期"
															name="closureTime">
															<DatePicker
																disabled
																placeholder="请选择"
																showTime
																format="YYYY-MM-DD HH:mm:ss"
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="计算书金额"
															name="calculationAmount"
															getValueFromEvent={
																(event: any) =>
																	event.target.value.replace(
																		/^(-)*(\d+)\.(\d\d).*$/,
																		'$1$2.$3',
																	) // 只能输入两位小数
															}
															rules={[
																{
																	pattern:
																		twoDecimalPattern,
																	message:
																		'请输入正确的金额',
																},
															]}>
															<Input
																placeholder="请输入"
																disabled
															/>
														</Form.Item>
													</Col>
													<Col
														sm={{span: 24}}
														md={{span: 12}}
														lg={{span: 8}}>
														<Form.Item
															label="是否重开案"
															name="openCaseType">
															<Select
																disabled
																placeholder="请选择"
																fieldNames={{
																	value: 'key',
																	label: 'label',
																}}
																options={[
																	...compliance,
																]}
															/>
														</Form.Item>
													</Col>
												</Row>
											</Form>
										),
									},
									{
										label: '事故照片',
										key: '4',
										children: (
											<Form
												form={accidentForm}
												name="basic"
												layout="horizontal"
												labelCol={{flex: '0px'}}
												labelAlign="right"
												labelWrap
												initialValues={{remember: true}}
												autoComplete="off"
												disabled={type === 'view'}>
												<Row gutter={12}>
													<Col sm={{span: 24}}>
														<Form.Item
															label=""
															name="photoList">
															<UploadAvatar
																{...uploadProps}
															/>
														</Form.Item>
													</Col>
												</Row>
											</Form>
										),
									},
								]}
							/>
						</div>
					</Panel>
				</Collapse>
				<div className={styles.wrap}>
					<Button
						onClick={() => {
							history.goBack()
						}}>
						取消
					</Button>
					{type === 'add' || type === 'edit' ? (
						<>
							<Button
								type="primary"
								htmlType="submit"
								onClick={onSubmit}>
								保存
							</Button>
						</>
					) : (
						''
					)}
				</div>
			</div>
		</div>
	)
})
export default connect(({user}: any) => ({user, global}))(licenceEdit)
